<?php

/**
 * @Create by PhpStorm
 * @author:jinxiu89@163.com
 * @Create Date:2020/6/2 15:17
 * @User: admin
 * @Current File : ProductCategory.php
 * @格言：溪涧岂能留得住，终归大海做波涛 --李忱
 * @格言： 我的内心因看见大海而波涛汹涌
 **/

namespace app\admin\controller\content;


use app\admin\controller\BaseAdmin;
use think\App;
use think\facade\View;

/**
 * Class ProductCategory
 * @package app\admin\controller\content
 */
class ProductCategory extends BaseAdmin
{
    public function initialize()
    {
        parent::initialize(); // TODO: Change the autogenerated stub
    }

    /**
     * ProductCategory constructor.
     * @param App $app
     */
    public function __construct(App $app)
    {
        parent::__construct($app);
    }

    public function index()
    {
        if ($this->request->isGet()) {
            return View::fetch();
        }
    }
    /**
     * sortorder
     *
     * @Author: kevin qiu
     * @DateTime: 2020-09-25
     * @return void
     */
    public function sortorder()
    {
        if ($this->request->isPost()) {
            $data = input('post.', [], 'trim');
            if (!$this->validate->scene('sortorder')->check($data)) return show(0, $this->validate->getError()); //后台验证数据合法性
            $status = $this->service->sortorder((array) $data);
            if ($status == true) {
                return show(1, '保存成功');
            }
            return show(0, '不明原因，保存失败');
        }
    }
}